package com.simple.crawler.core;

import com.simple.crawler.utils.StringUtils;

import java.util.concurrent.LinkedBlockingDeque;

public class TaskQueue extends LinkedBlockingDeque<Task> {

    private String id = StringUtils.getId();

    public String getId() {
        return id;
    }

    @Override
    public synchronized Task pop() {
        if (this.isEmpty()) {
            return null;
        }
        return super.pop();
    }

    @Override
    public synchronized int size() {
        return super.size();
    }

}
